package com.example.kisstheflag;

public final class Constants {

	public static final int TAG_JUNQI = 0;
	public static final int TAG_SILING = 9;
	public static final int TAG_JUNZHANG = 8;
	public static final int TAG_SHIZHANG = 7;
	public static final int TAG_LVZHANG = 6;
	public static final int TAG_TUANZHANG = 5;
	public static final int TAG_YINGZHANG = 4;
	public static final int TAG_LIANZHANG = 3;
	public static final int TAG_PAIZHANG = 2;
	public static final int TAG_GONGBING = 1;
	public static final int TAG_ZHADAN = -1;
	public static final int TAG_DILEI = -2;

	public static final int FLAG_WIN = 1;
	public static final int FLAG_TOGETHER = 0;
	public static final int FLAG_DIE = -1;

	public static final int QUEUE_LENGTH = 25;
	public static final int RIVER_COUNT = 21;

	public static final int getSimpleTextByType(int type) {
		int ret = R.string.text_simple;
		switch (type) {
		case TAG_JUNQI:
			ret = R.string.text_junqi_simple;
			break;
		case TAG_SILING:
			ret = R.string.text_siling_simple;
			break;
		case TAG_JUNZHANG:
			ret = R.string.text_junzhang_simple;
			break;
		case TAG_SHIZHANG:
			ret = R.string.text_shizhang_simple;
			break;
		case TAG_LVZHANG:
			ret = R.string.text_lvzhang_simple;
			break;
		case TAG_TUANZHANG:
			ret = R.string.text_tuanzhang_simple;
			break;
		case TAG_YINGZHANG:
			ret = R.string.text_yingzhang_simple;
			break;
		case TAG_LIANZHANG:
			ret = R.string.text_lianzhang_simple;
			break;
		case TAG_PAIZHANG:
			ret = R.string.text_paizhang_simple;
			break;
		case TAG_GONGBING:
			ret = R.string.text_gongbing_simple;
			break;
		case TAG_ZHADAN:
			ret = R.string.text_zhadan_simple;
			break;
		case TAG_DILEI:
			ret = R.string.text_dilei_simple;
			break;
		default:
			break;
		}
		return ret;
	}

	public static final int getTextByType(int type) {
		int ret = R.string.text_simple;
		switch (type) {
		case TAG_JUNQI:
			ret = R.string.text_junqi;
			break;
		case TAG_SILING:
			ret = R.string.text_siling;
			break;
		case TAG_JUNZHANG:
			ret = R.string.text_junzhang;
			break;
		case TAG_SHIZHANG:
			ret = R.string.text_shizhang;
			break;
		case TAG_LVZHANG:
			ret = R.string.text_lvzhang;
			break;
		case TAG_TUANZHANG:
			ret = R.string.text_tuanzhang;
			break;
		case TAG_YINGZHANG:
			ret = R.string.text_yingzhang;
			break;
		case TAG_LIANZHANG:
			ret = R.string.text_lianzhang;
			break;
		case TAG_PAIZHANG:
			ret = R.string.text_paizhang;
			break;
		case TAG_GONGBING:
			ret = R.string.text_gongbing;
			break;
		case TAG_ZHADAN:
			ret = R.string.text_zhadan;
			break;
		case TAG_DILEI:
			ret = R.string.text_dilei;
			break;
		default:
			break;
		}
		return ret;
	}

	public static final int fightTogether(int river, int highland) {
		if (highland == TAG_JUNQI) {
			return FLAG_TOGETHER;
		} else if (river == TAG_ZHADAN || highland == TAG_ZHADAN) {
			return FLAG_TOGETHER;
		} else if (highland == TAG_DILEI) {
			if (river == TAG_GONGBING) {
				return FLAG_WIN;
			} else {
				return FLAG_TOGETHER;
			}
		} else {
			if (river == highland) {
				return FLAG_TOGETHER;
			} else if (river < highland) {
				return FLAG_DIE;
			} else {
				return FLAG_WIN;
			}
		}
	}
}
